<script type="text/html" template lay-done="layui.data.done(d);">
    <div class="layui-form coreshop-form" lay-filter="LAY-app-CoreCmsGoods-createForm" id="LAY-app-CoreCmsGoods-createForm">

        <div class="layui-form-item">
            <label for="id" class="layui-form-label">商品ID</label>
            <div class="layui-input-inline">
                <input name="id" id="id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【商品ID】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="bn" class="layui-form-label">商品编码</label>
            <div class="layui-input-inline">
                <input name="bn" id="bn" lay-verType="tips" lay-verify="required|verifybn" class="layui-input" lay-reqText="请输入【商品编码】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="name" class="layui-form-label">商品名称</label>
            <div class="layui-input-inline">
                <input name="name" id="name" lay-verType="tips" lay-verify="required|verifyname" class="layui-input" lay-reqText="请输入【商品名称】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="brief" class="layui-form-label">商品简介</label>
            <div class="layui-input-inline">
                <input name="brief" id="brief" lay-verType="tips" lay-verify="required|verifybrief" class="layui-input" lay-reqText="请输入【商品简介】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="price" class="layui-form-label">商品价格</label>
            <div class="layui-input-inline">
                <input name="price" id="price" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品价格】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="costprice" class="layui-form-label">成本价</label>
            <div class="layui-input-inline">
                <input name="costprice" id="costprice" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【成本价】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="mktprice" class="layui-form-label">市场价</label>
            <div class="layui-input-inline">
                <input name="mktprice" id="mktprice" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【市场价】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="imageIds" class="layui-form-label">默认图片 图片id</label>
            <div class="layui-input-inline">
                <input name="imageIds" id="imageIds" lay-verType="tips" lay-verify="required|verifyimageIds" class="layui-input" lay-reqText="请输入【默认图片 图片id】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="goodsCategoryId" class="layui-form-label">商品分类ID 关联category.id</label>
            <div class="layui-input-inline">
                <input name="goodsCategoryId" id="goodsCategoryId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【商品分类ID 关联category.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="goodsTypeId" class="layui-form-label">商品类别ID 关联goods_type.id</label>
            <div class="layui-input-inline">
                <input name="goodsTypeId" id="goodsTypeId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【商品类别ID 关联goods_type.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="brandId" class="layui-form-label">品牌ID 关联brand.id</label>
            <div class="layui-input-inline">
                <input name="brandId" id="brandId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【品牌ID 关联brand.id】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isNomalVirtual" class="layui-form-label">是否虚拟商品</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isNomalVirtual" id="isNomalVirtual" lay-skin="switch" lay-text="关闭|开启">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isMarketable" class="layui-form-label">是否上架</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isMarketable" id="isMarketable" lay-skin="switch" lay-text="关闭|开启">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="stock" class="layui-form-label">库存</label>
            <div class="layui-input-inline">
                <input name="stock" id="stock" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【库存】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="freezeStock" class="layui-form-label">冻结库存</label>
            <div class="layui-input-inline">
                <input name="freezeStock" id="freezeStock" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【冻结库存】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="weight" class="layui-form-label">重量</label>
            <div class="layui-input-inline">
                <input name="weight" id="weight" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【重量】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="unit" class="layui-form-label">商品单位</label>
            <div class="layui-input-inline">
                <input name="unit" id="unit" lay-verType="tips" lay-verify="required|verifyunit" class="layui-input" lay-reqText="请输入【商品单位】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="intro" class="layui-form-label">商品详情</label>
            <div class="layui-input-inline">
                <input name="intro" id="intro" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品详情】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="spes_desc" class="layui-form-label">商品规格序列号存储</label>
            <div class="layui-input-inline">
                <input name="spes_desc" id="spes_desc" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【商品规格序列号存储】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="parameters" class="layui-form-label">参数序列化</label>
            <div class="layui-input-inline">
                <input name="parameters" id="parameters" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【参数序列化】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="commentsCount" class="layui-form-label">评论次数</label>
            <div class="layui-input-inline">
                <input name="commentsCount" id="commentsCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【评论次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="viewCount" class="layui-form-label">浏览次数</label>
            <div class="layui-input-inline">
                <input name="viewCount" id="viewCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【浏览次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="buyCount" class="layui-form-label">购买次数</label>
            <div class="layui-input-inline">
                <input name="buyCount" id="buyCount" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【购买次数】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="uptime" class="layui-form-label">上架时间</label>
            <div class="layui-input-inline">
                <input name="uptime" id="createTime-CoreCmsGoods-uptime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【上架时间】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="downtime" class="layui-form-label">下架时间</label>
            <div class="layui-input-inline">
                <input name="downtime" id="createTime-CoreCmsGoods-downtime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【下架时间】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="sort" class="layui-form-label">商品排序</label>
            <div class="layui-input-inline">
                <input name="sort" id="sort" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" lay-reqText="请输入【商品排序】并为数字" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="labelIds" class="layui-form-label">标签id逗号分隔</label>
            <div class="layui-input-inline">
                <input name="labelIds" id="labelIds" lay-verType="tips" lay-verify="required|verifylabelIds" class="layui-input" lay-reqText="请输入【标签id逗号分隔】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="newSpec" class="layui-form-label">自定义规格名称</label>
            <div class="layui-input-inline">
                <input name="newSpec" id="newSpec" lay-verType="tips" lay-verify="required" class="layui-input" lay-reqText="请输入【自定义规格名称】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="createTime" class="layui-form-label">创建时间</label>
            <div class="layui-input-inline">
                <input name="createTime" id="createTime-CoreCmsGoods-createTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【创建时间】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="updateTime" class="layui-form-label">更新时间</label>
            <div class="layui-input-inline">
                <input name="updateTime" id="createTime-CoreCmsGoods-updateTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" lay-reqText="请输入【更新时间】" />
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isRecommend" class="layui-form-label">是否推荐</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isRecommend" id="isRecommend" lay-skin="switch" lay-text="关闭|开启">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isHot" class="layui-form-label">是否热门</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isHot" id="isHot" lay-skin="switch" lay-text="关闭|开启">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="isDel" class="layui-form-label">是否删除</label>
            <div class="layui-input-inline">
                <input type="checkbox" lay-filter="switch" name="isDel" id="isDel" lay-skin="switch" lay-text="关闭|开启">
            </div>
            <div class="layui-inline">
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsGoods-createForm-submit" id="LAY-app-CoreCmsGoods-createForm-submit" value="确认添加">
        </div>
    </div>
</script>
<script>
    layui.data.done = function (d) {
        layui.use(['admin', 'form', 'laydate','coreHelper'],
            function() {
                var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , laydate = layui.laydate
                , coreHelper = layui.coreHelper;

                laydate.render({
                    elem: '#createTime-CoreCmsGoods-uptime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#createTime-CoreCmsGoods-downtime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#createTime-CoreCmsGoods-createTime',
                    type: 'datetime'
                });
                laydate.render({
                    elem: '#createTime-CoreCmsGoods-updateTime',
                    type: 'datetime'
                });
	            form.verify({

		            verifybn: [/^[\S]{0,30}$/,'商品编码最大只允许输入30位字符，且不能出现空格'],
		            verifyname: [/^[\S]{0,200}$/,'商品名称最大只允许输入200位字符，且不能出现空格'],
		            verifybrief: [/^[\S]{0,255}$/,'商品简介最大只允许输入255位字符，且不能出现空格'],
		            verifyimageIds: [/^[\S]{0,255}$/,'默认图片 图片id最大只允许输入255位字符，且不能出现空格'],
		            verifyunit: [/^[\S]{0,20}$/,'商品单位最大只允许输入20位字符，且不能出现空格'],
		            verifylabelIds: [/^[\S]{0,50}$/,'标签id逗号分隔最大只允许输入50位字符，且不能出现空格'],
	            });
                //重载form
                form.render(null, 'LAY-app-CoreCmsGoods-createForm');
            })
    };
</script>